home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 031-040 / amok38 / hotprog / hotprogz.zoo / HotProg / HotProg1.0.mod < prev    next >
Text File  |  1990-03-14  |  22KB  |  634 lines

  1. (*---------------------------------------------------------------------------
  2.     :Program.    HotProg.mod
  3.     :Contents.   Controll Your System, anywhere you are
  4.     :Author.     Christian Ueberall
  5.     :Address.    Urbanstr.171, 7300 Eßlingen West-Germany,
  6.     :Phone.      0711/318310
  7.     :Version     V1.0
  8.     :Date        22.2.1990
  9.     :Copyright.  PD
  10.     :Language.   Modula-2
  11.     :Translator. M2Amiga V3.2d
  12.     :Imports.    HotKey    from Bernd Preusing      {AMOK #21}
  13.     :Imports.    TurboFiles from Stefan Salewski    {AMOK #24}
  14.     :Imports.    Process from Markus Peuckert       {AMOK #31}
  15.     :Imports.    ARP library  from Fridtjof Siebert {AMOK #14}
  16.     :Remarx      Thanx to all this guys above for their helpfull Modules
  17. ---------------------------------------------------------------------------*)
  18.  
  19. MODULE HotProg;
  20. FROM SYSTEM  IMPORT ADR,ADDRESS;
  21. FROM Exec    IMPORT GetMsg,ReplyMsg,WaitPort,MemReqs,MemReqSet;
  22. FROM ARP     IMPORT Execute,ArpAllocMem,FileRequest, FileRequester, FileName,
  23.                     DirName,FileReqFlags,FileReqFlagSet,ArpOpen,ProcessCtrlBlk,
  24.                     PCBFlagSet,PCBFlags,Delay,Lock,CurrentDir,UnLock,TackOn;
  25. FROM HotKey  IMPORT InstallKey;
  26. FROM Str     IMPORT Length;
  27. FROM Arts    IMPORT Assert;
  28. FROM UserLib IMPORT GetComplementColors;
  29. FROM Dos     IMPORT FileHandlePtr,ProcessPtr;
  30. FROM Process IMPORT CreateFuncProcess;
  31. FROM Intuition IMPORT IntuitionBase,IntuitionBasePtr,WindowPtr,ScreenPtr,
  32.                    Window,OpenWindow,NewWindow,CloseWindow,OpenIntuition,
  33.                    IDCMPFlagSet,WindowFlagSet,WindowFlags,customScreen,
  34.                    IntuiMessage,IDCMPFlags,selectUp,WBenchToFront;
  35. FROM InputEvent  IMPORT    Qualifiers, QualifierSet;
  36. FROM Graphics    IMPORT Text,Move,jam2,jam1,DrawModeSet,DrawModes,SetDrMd,
  37.                    SetAPen,SetBPen,ViewModes,ViewPort,RectFill;
  38. FROM TurboFiles  IMPORT Lookup,CloseFile,TurboResult,File,FilePtr,ReadOnly,
  39.                    TurboRead,TurboFileLength;
  40. FROM Arguments   IMPORT NumArgs,GetArg;
  41.  
  42. TYPE String = ARRAY [0..79] OF CHAR;
  43.  
  44. CONST   bufferSize = 1024;
  45.         topOffset  = 10;
  46.         leftOffset = 0;
  47.         rightOffset= 0;
  48.         charWidth  = 8;
  49.         height     = 9;
  50.  
  51. VAR menuName,filePath,
  52.     initialMsg      : ARRAY [0..79] OF String;
  53.     path,command    :  String;
  54.     wbFlag          : ARRAY [0..59] OF BOOLEAN;
  55.     filePtr         : FilePtr;
  56.     result          : TurboResult;
  57.     ok,config       : BOOLEAN;
  58.     hotKey          : CARDINAL;
  59.     qualifier       : QualifierSet;
  60.     msgWindow       : NewWindow;
  61.     msgWindowPtr    : WindowPtr;
  62.     intuiBasePtr    : IntuitionBasePtr;
  63.     activeScreenPtr : ScreenPtr;
  64.     viewPort        : ViewPort;
  65.     intuiMsgPtr     : POINTER TO IntuiMessage;
  66.     class           : IDCMPFlagSet;
  67.     msgCode            : CARDINAL;
  68.     ProcPtr         : ProcessPtr;
  69.     entries,
  70.     maxLength,len,
  71.     lines,mouseX,
  72.     mouseY,
  73.     myWindowWidth,
  74.     myWindowHeight,
  75.     i,msgLength,
  76.     actualLength,
  77.     interlace,hiRes : INTEGER;
  78.     fileRequester   : FileRequester;
  79.     fName           : FileName;
  80.     dName           : DirName;
  81.     configFile      : String;
  82.  
  83. PROCEDURE ReadConfig(configFile : ARRAY OF CHAR);
  84.  
  85. VAR wert        : ARRAY [0..14] OF CHAR;
  86.     variable    : ARRAY [0..10] OF CHAR;
  87.     len,actual  : LONGINT;
  88.     buffer      : ADDRESS;
  89.     charPtr     : POINTER TO CHAR;
  90.     i           : INTEGER;
  91.     trennung    : CHAR;
  92.     configFile0,
  93.     configFile1 : String;
  94.  
  95.  
  96. PROCEDURE ReadVar();
  97.  
  98. BEGIN
  99.     INC(charPtr);
  100.     DEC(len);
  101.     i := 0;
  102.     WHILE (charPtr^#"=") AND (i<SIZE(variable)) DO
  103.         variable[i] := charPtr^;
  104.         INC(charPtr);
  105.         DEC(len);
  106.         INC(i);
  107.     END;
  108.     variable[i] := 0C;
  109.     INC(charPtr);
  110.     DEC(len);
  111.     i := 0;
  112.     WHILE (charPtr^#12C) DO
  113.         wert[i]    := charPtr^;
  114.         INC(i);
  115.         INC(charPtr);
  116.         DEC(len);
  117.     END;
  118.     wert[i] := 0C;
  119.     CASE CAP(variable[0]) OF
  120.         "T"    :
  121.         trennung := wert[0];|
  122.         "H" :
  123.             CASE (CAP(wert[0])) OF
  124.                 "^"    :
  125.                     hotKey := (ORD(wert[1])-48)*10+ORD(wert[2])-48;|
  126.                 "#"    :
  127.                     hotKey := (ORD(wert[1])-48)*10+ORD(wert[2])-48;|
  128.                 "F"    :
  129.                     hotKey := ORD(wert[1])+31;
  130.                     IF ((hotKey < 80) OR (hotKey > 88)) THEN
  131.                         hotKey := 89;
  132.                     END;|
  133.                 "E" :
  134.                     hotKey := 69;|
  135.                 "S" :
  136.                     hotKey := 64;|
  137.                 "H"    :
  138.                     hotKey := 95;|
  139.                 "L" :
  140.                     CASE (CAP(wert[1])) OF
  141.                         "C" :
  142.                             hotKey := 102;|
  143.                         "S" :
  144.                             hotKey := 96;|
  145.                         "A" :
  146.                             hotKey := 100;|
  147.                     ELSE
  148.                         hotKey := 69;
  149.                     END;|
  150.                 "R" :
  151.                     CASE (CAP(wert[1])) OF
  152.                         "C" :
  153.                             hotKey := 103;|
  154.                         "S" :
  155.                             hotKey := 97;|
  156.                         "A" :
  157.                             hotKey := 101;|
  158.                     ELSE
  159.                         hotKey := 69;
  160.                     END;|
  161.                 "C" :
  162.                     hotKey := 99;|
  163.             ELSE
  164.                 hotKey := 69;        (* DEFAULT HOTKEY ESC *)
  165.             END;|
  166.         "Q" :
  167.             CASE CAP(wert[0]) OF
  168.                 "C" :
  169.                     CASE CAP(wert[1]) OF
  170.                         "O" :
  171.                             qualifier := QualifierSet{control};|
  172.                         "A" :
  173.                             qualifier := QualifierSet{capsLock};|
  174.                     ELSE
  175.                         qualifier := QualifierSet{lAlt};
  176.                     END;|
  177.                 "L" :
  178.                     CASE CAP(wert[1]) OF
  179.                         "S" :
  180.                             qualifier := QualifierSet{lShift};|
  181.                         "C" :
  182.                             qualifier := QualifierSet{lCommand};|
  183.                         "E" :
  184.                             qualifier := QualifierSet{leftButton};|
  185.                         "A" :
  186.                             qualifier := QualifierSet{lAlt};|
  187.                     ELSE
  188.                         qualifier := QualifierSet{lAlt};
  189.                     END;|
  190.                 "R" :
  191.                     CASE CAP(wert[1]) OF
  192.                         "S" :
  193.                             qualifier := QualifierSet{rShift};|
  194.                         "C" :
  195.                             qualifier := QualifierSet{rCommand};|
  196.                         "I" :
  197.                             qualifier := QualifierSet{rightButton};|
  198.                         "E" :
  199.                             qualifier := QualifierSet{relativeMouse};|
  200.                         "A" :
  201.                             qualifier := QualifierSet{rAlt};|
  202.                     ELSE
  203.                         qualifier := QualifierSet{lAlt};
  204.                     END;|
  205.             ELSE
  206.                 qualifier := QualifierSet{lAlt};
  207.             END;|
  208.         ELSE
  209.             qualifier := QualifierSet{lAlt};    (* default leftALT *)
  210.             hotKey    := 69;                        (* default ESC *)
  211.         END;
  212. END ReadVar;
  213.  
  214. BEGIN
  215.     entries := 0;
  216.     lines   := 0;
  217.     configFile0 := "HotProg.config";
  218.     configFile1 := "SYS:s/HotProg.config";
  219.  
  220.     IF Length(configFile) = 0 THEN
  221.         result := Lookup(filePtr,configFile0,bufferSize,ReadOnly);
  222.         IF (result#done) THEN
  223.             result := Lookup(filePtr,configFile1,bufferSize,ReadOnly);
  224.         END;
  225.     ELSE
  226.         result := Lookup(filePtr,configFile,bufferSize,ReadOnly);
  227.     END;
  228.  
  229.     IF (result=done) THEN                        (* ConfigFile vorhanden *)
  230.         len    := TurboFileLength(filePtr);
  231.         buffer := ArpAllocMem(len,MemReqSet{fast});
  232.         IF (buffer#NIL) THEN                     (* genug Speicher *)
  233.             TurboRead(filePtr,buffer,len,actual);
  234.             CloseFile(filePtr);
  235.             charPtr := buffer;
  236.             WHILE (len > 0) DO
  237.                 IF (charPtr^="@") THEN            (* Kommentare überspringen *)
  238.                     WHILE (charPtr^#12C) DO
  239.                         INC(charPtr);
  240.                         DEC(len);
  241.                     END;
  242.                 ELSIF (charPtr^="%") THEN         (* Initial Message *)
  243.                     INC(charPtr);
  244.                     DEC(len);
  245.                     i    := 0;
  246.                     WHILE (charPtr^#12C) DO
  247.                         initialMsg[lines][i] := charPtr^;
  248.                         actualLength := i;
  249.                         IF (actualLength > msgLength) THEN
  250.                             msgLength := actualLength;
  251.                         END;
  252.                         INC(charPtr);
  253.                         DEC(len);
  254.                         INC(i);
  255.                     END;
  256.                     INC(lines);
  257.                 ELSIF (charPtr^="§") THEN
  258.                     ReadVar(); (* HotKey,Quali und TrennChar einlesen *)
  259.                 ELSE
  260.                     WHILE (charPtr^#12C) DO
  261.                         i := 0;
  262.                         WHILE (charPtr^#trennung) DO    (* menuName einlesen *)
  263.                             menuName[entries][i] := charPtr^;
  264.                             INC(charPtr);
  265.                             Assert(charPtr^#12C,ADR("fehlende Trennung in config"));
  266.                             DEC(len);
  267.                             INC(i);
  268.                             Assert(i < SIZE(menuName[entries]),ADR("menuName zu lang")) ;
  269.                             actualLength := i;
  270.                             IF (actualLength > maxLength) THEN
  271.                                 maxLength := actualLength;
  272.                             END;
  273.                         END;
  274.                         menuName[entries][i] := 0C;
  275.                         INC(charPtr);
  276.                         DEC(len);
  277.                         i    := 0;
  278.                         WHILE (charPtr^#trennung) DO    (* MenuPfad einilesen *)
  279.                             filePath[entries][i] := charPtr^;
  280.                             INC(charPtr);
  281.                             Assert(charPtr^#12C,ADR("fehlende Trennung in config"));
  282.                             DEC(len);
  283.                             INC(i);
  284.                             Assert(i < SIZE(filePath[entries]),ADR("filePfad zu lang")) ;
  285.                         END;
  286.                         filePath[entries][i] := 0C;
  287.                         INC(charPtr);
  288.                         DEC(len);
  289.                         IF CAP(charPtr^)="T" THEN        (* WBenchToFront ? *)
  290.                             wbFlag[entries] := TRUE;
  291.                         ELSE
  292.                             wbFlag[entries] := FALSE;
  293.                         END;
  294.                         WHILE (charPtr^#trennung) AND (charPtr^#12C) DO
  295.                             INC(charPtr);
  296.                             IF (charPtr^=12C) THEN
  297.                                 DEC(charPtr);
  298.                                 charPtr^ :=trennung;
  299.                             ELSE
  300.                                 DEC(len);
  301.                             END;
  302.                         END;
  303.                         INC(charPtr);
  304.                         DEC(len);
  305.                         INC(entries);
  306.                     END;
  307.                     INC(charPtr);
  308.                     DEC(len);
  309.                 END;
  310.             END;
  311.         END;
  312.         config := TRUE;
  313.     ELSE
  314.         initialMsg[0] := "Habe leider kein File    ";
  315.         initialMsg[1] := "s:HotProg.config gefunden";
  316.         lines     := 2;
  317.         msgLength := 25;
  318.         config    := FALSE;
  319.     END;
  320. END ReadConfig;
  321.  
  322. PROCEDURE GetPath(command : String;VAR path : String);
  323.  
  324. VAR    i : INTEGER;
  325.  
  326. BEGIN
  327.  
  328.     i := 0;
  329.     WHILE (command[i]#0C) AND (command[i]#40C) DO (* bis zum ersten Space *)
  330.         path[i] := command[i];
  331.         INC(i);
  332.     END;
  333.     path[i] := 0C;
  334.  
  335. END GetPath;
  336.  
  337. PROCEDURE StartProc;
  338.  
  339. VAR erg : LONGINT;
  340.  
  341. BEGIN
  342.     erg := Execute(ADR(filePath[(mouseY DIV height)-1]),NIL,NIL);
  343. END StartProc;
  344.  
  345. PROCEDURE NewConfig();
  346. VAR activeWindowPtr : WindowPtr;
  347.  
  348. BEGIN
  349.     fName    := "hotprog.config";
  350.     dName     := "s:";
  351.     activeWindowPtr := intuiBasePtr^.activeScreen^.firstWindow;
  352.  
  353.     WITH fileRequester DO
  354.         hail      := ADR("File-Requester");
  355.         ddef      := ADR(fName);
  356.         ddir      := ADR(dName);
  357.         wind      := ADR(activeWindowPtr^);
  358.         funcFlags := FileReqFlagSet{doColor,newIDCMP};
  359.         reserved1 := 0;
  360.         function  := NIL;
  361.         reserved2 := 0;
  362.     END;
  363.  
  364.     IF FileRequest(ADR(fileRequester)) # NIL THEN
  365.         TackOn(ADR(dName),ADR(fName));    (* fileName an Pfad fügen *)
  366.         ReadConfig(dName);
  367.     END;
  368. END NewConfig;
  369.  
  370. PROCEDURE Hot();
  371.  
  372. VAR actWindowPtr: WindowPtr;
  373.     winTitelPtr : POINTER TO String;
  374.     winTitel    : String;
  375.     oldMouseY,
  376.     color0,
  377.     color1,
  378.     depth       : INTEGER;
  379.     ok          : BOOLEAN;
  380.     myWindow    : NewWindow;
  381.     myWindowPtr : WindowPtr;
  382.     activeScreenPtr : ScreenPtr;
  383.  
  384. BEGIN
  385.     winTitel  := "";
  386.     i         := 0;
  387.     oldMouseY := 1000;
  388.     ProcPtr   := NIL;
  389.  
  390.     myWindowWidth  := leftOffset+rightOffset+maxLength*charWidth;
  391.     myWindowHeight := 2+topOffset+entries*height;
  392.  
  393.     activeScreenPtr := intuiBasePtr^.activeScreen;
  394.     IF (myWindowHeight > activeScreenPtr^.height) THEN
  395.         myWindowHeight := activeScreenPtr^.height;
  396.         entries := (myWindowHeight-topOffset) DIV height;
  397.     END;
  398.     IF (myWindowWidth > activeScreenPtr^.width) THEN
  399.         myWindowWidth := activeScreenPtr^.width;
  400.     END;
  401.  
  402.     interlace := 1;
  403.     hiRes     := 1;
  404.     viewPort  := activeScreenPtr^.viewPort;
  405.     IF (lace IN viewPort.modes) THEN                (* InterLace ? *)
  406.           interlace := 2;
  407.     END;
  408.     IF NOT(hires IN viewPort.modes) THEN            (* LowRes ?  *)
  409.         hiRes := 2;
  410.     END;
  411.  
  412.       mouseX := (intuiBasePtr^.mouseX/hiRes)-myWindowWidth/2;
  413.       mouseY := interlace*intuiBasePtr^.mouseY/2-myWindowHeight/2;
  414.     IF (mouseX > activeScreenPtr^.width-myWindowWidth) THEN
  415.         mouseX := activeScreenPtr^.width-myWindowWidth;
  416.     END;
  417.     IF (mouseX <0) THEN mouseX := 0 END;
  418.     IF (mouseY > activeScreenPtr^.height-myWindowHeight) THEN
  419.         mouseY := activeScreenPtr^.height-myWindowHeight;
  420.     END;
  421.     IF (mouseY <0) THEN mouseY := 0 END;
  422.  
  423.     WITH myWindow DO
  424.         leftEdge    := mouseX;
  425.         topEdge     := mouseY;
  426.         width       := myWindowWidth;
  427.         height      := myWindowHeight;
  428.         detailPen   := 1;
  429.         blockPen    := 0;
  430.         idcmpFlags  := IDCMPFlagSet{inactiveWindow,mouseButtons,mouseMove,
  431.                                     menuVerify,closeWindow};
  432.         flags       := WindowFlagSet{activate,reportMouse,windowDrag,menuState,
  433.                                     windowClose,windowDepth};
  434.         firstGadget := NIL;
  435.         checkMark   := NIL;
  436.         title       := intuiBasePtr^.activeWindow^.title;
  437.         screen      := activeScreenPtr;
  438.         bitMap      := NIL;
  439.         type        := customScreen;
  440.     END;
  441.  
  442.     myWindowPtr := OpenWindow(myWindow);
  443.     color0 := 1;
  444.     color1 := 1;
  445.     depth  := activeScreenPtr^.bitMap.depth;
  446.     IF depth > 5 THEN depth := 5 END;
  447.     IF depth > 1 THEN
  448.         FOR i := 0 TO depth-1 DO
  449.             color1    := 2*color1;
  450.         END;
  451.         color1 := color1-1;
  452.         GetComplementColors(activeScreenPtr,color0,color1);
  453.     ELSE
  454.         color0 := 0;
  455.     END;
  456.     myWindowPtr^.rPort^.fgPen := color1;
  457.     myWindowPtr^.rPort^.bgPen := color0;
  458.     SetDrMd(myWindowPtr^.rPort,jam2);
  459.     IF (myWindowPtr # NIL) THEN
  460.         FOR i := 0 TO entries DO
  461.             Move(myWindowPtr^.rPort,leftOffset,topOffset+height+i*height);
  462.             Text(myWindowPtr^.rPort,ADR(menuName[i]),Length(menuName[i]));
  463.         END;
  464.  
  465.         LOOP
  466.             WaitPort(myWindowPtr^.userPort);
  467.             intuiMsgPtr    := GetMsg(myWindowPtr^.userPort);
  468.  
  469.  
  470.             WHILE (intuiMsgPtr # NIL) DO
  471.                 class  := intuiMsgPtr^.class;
  472.                 msgCode   := intuiMsgPtr^.code;
  473.                 mouseX := intuiMsgPtr^.mouseX;
  474.                 mouseY := intuiMsgPtr^.mouseY-1;
  475.  
  476.                 ReplyMsg(intuiMsgPtr);
  477.                 IF (inactiveWindow IN class) OR (mouseY <0) OR
  478.                     (mouseY > myWindowHeight) OR (mouseX < 0) OR
  479.                     (mouseX > myWindowWidth) THEN
  480.                     CloseWindow(myWindowPtr);
  481.                     EXIT;
  482.                 END;
  483.                 IF (closeWindow IN class) THEN
  484.                     CloseWindow(myWindowPtr);
  485.                     InstallKey(hotKey,qualifier,Hot,ADR("HotProgPort1.0"));
  486.                     EXIT;
  487.                 END;
  488.                 IF (mouseY >9) THEN
  489.                     IF (mouseButtons IN class) THEN
  490.                         IF (selectUp = msgCode) THEN
  491.                             command    := filePath[(mouseY DIV height)-1];
  492.                             GetPath(command,path);
  493.                             result := Lookup(filePtr,path,bufferSize,ReadOnly);
  494.                             IF (result=done) THEN
  495.                                 CloseFile(filePtr);
  496.                                 ProcPtr := CreateFuncProcess (menuName[(mouseY DIV height)-1],0,8000,ADR(StartProc));
  497.                                 IF wbFlag[(mouseY DIV height)-1] THEN
  498.                                     ok := WBenchToFront();
  499.                                 END;
  500.                             END;
  501.                         END;
  502.                     END;
  503.                     IF (mouseMove IN class) THEN
  504.                         IF (mouseY DIV height # oldMouseY DIV height)  THEN
  505.                             IF (oldMouseY<1000) THEN
  506.                                 SetDrMd(myWindowPtr^.rPort,jam2);
  507.                                 Move(myWindowPtr^.rPort,leftOffset,(oldMouseY +topOffset-(oldMouseY MOD height)));
  508.                                 Text(myWindowPtr^.rPort,ADR(menuName[(oldMouseY DIV height)-1]),Length(menuName[(oldMouseY DIV height)-1]));
  509.                             END;
  510.                             SetDrMd(myWindowPtr^.rPort,DrawModeSet{inversvid}+jam2);
  511.                             Move(myWindowPtr^.rPort,leftOffset,(mouseY +topOffset-(mouseY MOD height)));
  512.                             Text(myWindowPtr^.rPort,ADR(menuName[(mouseY DIV height)-1]),Length(menuName[(mouseY DIV height)-1]));
  513.                         END;
  514.                     END;
  515.                     IF menuVerify IN class THEN
  516.                         CloseWindow(myWindowPtr);
  517.                         NewConfig();
  518.                         EXIT;
  519.                     END;
  520.                     oldMouseY := mouseY;
  521.                 END;
  522.                 intuiMsgPtr := GetMsg(myWindowPtr^.userPort);
  523.             END;
  524.         END;
  525.     END;
  526.  
  527. END Hot;
  528.  
  529. PROCEDURE InitialMsgWindow();
  530.  
  531. BEGIN
  532.     intuiBasePtr    := OpenIntuition();
  533.     activeScreenPtr := intuiBasePtr^.activeScreen;
  534.     interlace := 1;
  535.     viewPort  := activeScreenPtr^.viewPort;
  536.     IF (lace IN viewPort.modes) THEN
  537.           interlace := 2;
  538.     END;
  539.     IF (lines=0) THEN
  540.         initialMsg[0] := "HotProg gestartet";
  541.         lines     := 1;
  542.         msgLength := 17;
  543.     END;
  544.     myWindowWidth  := leftOffset+rightOffset+msgLength*charWidth+charWidth;
  545.     myWindowHeight := 2+topOffset+lines*height;
  546.  
  547.     IF (myWindowHeight > activeScreenPtr^.height) THEN
  548.         myWindowHeight := activeScreenPtr^.height;
  549.         lines := (myWindowHeight-topOffset-2) DIV height;
  550.     END;
  551.     IF (myWindowWidth > activeScreenPtr^.width) THEN
  552.         myWindowWidth := activeScreenPtr^.width;
  553.     END;
  554.       mouseX := intuiBasePtr^.mouseX-10;
  555.       mouseY := interlace*intuiBasePtr^.mouseY/2-5;
  556.     IF (mouseX > activeScreenPtr^.width-myWindowWidth) THEN
  557.         mouseX := activeScreenPtr^.width-myWindowWidth;
  558.     END;
  559.     IF (mouseX <0) THEN mouseX := 0 END;
  560.     IF (mouseY > activeScreenPtr^.height-myWindowHeight) THEN
  561.         mouseY := activeScreenPtr^.height-myWindowHeight;
  562.     END;
  563.     IF (mouseY <0) THEN mouseY := 0 END;
  564.  
  565.     WITH msgWindow DO
  566.         leftEdge    := mouseX;
  567.         topEdge     := mouseY;
  568.         width       := myWindowWidth;
  569.         height      := myWindowHeight;
  570.         detailPen   := 1;
  571.         blockPen    := 0;
  572.         idcmpFlags  := IDCMPFlagSet{closeWindow};
  573.         flags       := WindowFlagSet{windowDrag,windowClose};
  574.         firstGadget := NIL;
  575.         checkMark   := NIL;
  576.         title       := intuiBasePtr^.activeWindow^.title;
  577.         screen      := activeScreenPtr;
  578.         bitMap      := NIL;
  579.         type        := customScreen;
  580.     END;
  581.  
  582.     msgWindowPtr    := OpenWindow(msgWindow);
  583.  
  584.     IF (msgWindowPtr#NIL) THEN
  585.         msgWindowPtr^.rPort^.fgPen := 1;
  586.         RectFill(msgWindowPtr^.rPort,0,11,myWindowWidth,myWindowHeight);
  587.         msgWindowPtr^.rPort^.fgPen := 2;
  588.         SetDrMd(msgWindowPtr^.rPort,jam1);
  589.         FOR i:= 0 TO lines DO
  590.             Move(msgWindowPtr^.rPort,leftOffset,topOffset+height+i*height);
  591.             Text(msgWindowPtr^.rPort,ADR(initialMsg[i]),Length(initialMsg[i]));
  592.         END;
  593.         LOOP
  594.             WaitPort(msgWindowPtr^.userPort);
  595.             intuiMsgPtr := GetMsg(msgWindowPtr^.userPort);
  596.  
  597.  
  598.             WHILE (intuiMsgPtr # NIL) DO
  599.                 class := intuiMsgPtr^.class;
  600.  
  601.                 ReplyMsg(intuiMsgPtr);
  602.                 IF (closeWindow IN class) THEN
  603.                     CloseWindow(msgWindowPtr);
  604.                     EXIT;
  605.                 END;
  606.                 intuiMsgPtr := GetMsg(msgWindowPtr^.userPort);
  607.             END;
  608.         END;
  609.     END;
  610.  
  611. END InitialMsgWindow;
  612.  
  613. PROCEDURE ReadArgs(VAR string : ARRAY OF CHAR);
  614. VAR args,len    : INTEGER;
  615.     
  616. BEGIN
  617.     args    := NumArgs();
  618.     IF NumArgs() > 0 THEN
  619.         GetArg(1,string,len);
  620.     END;
  621. END ReadArgs;
  622.  
  623.  
  624. BEGIN
  625.  
  626.     configFile := "";
  627.     ReadArgs(configFile);
  628.     ReadConfig(configFile);
  629.     InitialMsgWindow();
  630.     IF (config = TRUE) THEN
  631.         InstallKey(hotKey,qualifier,Hot,ADR("HotProgPort1.0"));
  632.     END;
  633. END HotProg.
  634.